#define _CRT_SECURE_NO_WARNINGS 1
/**
*      author: Y_Yao
*      created: 2024-09-20 09:03:21
**/


#include<iostream>
#include<vector>
#include<string>

using namespace std;
int dx[8] = { 1,1,2,2,-1,-1,-2,-2 };
int dy[8] = { 2,-2,1,-1,2,-2,1,-1 };
int p, q, ret;
string s;
int a;


void dfs(int x, int y, int n, vector<vector<bool>>& dp)
{
    s += 'A' + y;
    s += to_string(p - x);

    if (s.size() == p * q * 2)
    {
        if (a == 0)
        {
            cout << s << endl;
            cout << endl;
            a = 1;
        }
        return;
    }

    for (int i = 0;i < 8;i++)
    {
        int nx = x + dx[i], ny = y + dy[i];
        if (nx < 0 || nx >= p || ny < 0 || ny >= q || dp[nx][ny] == true) continue;
        dp[nx][ny] = true;
        dfs(nx, ny, n + 1, dp);
        dp[nx][ny] = false;
        s.pop_back();
        s.pop_back();
    }

}

void solve(int k)
{
    cin >> p >> q;
    cout << "Scenario #" << k << ":" << endl;
    vector<vector<bool>> dp(p, vector<bool>(q, false));

    for (int i = p - 1;i >= 0;i--)
        for (int j = 0;j < q;j++)
        {
            dp[i][j] = true;
            dfs(i, j, 1, dp);
            dp[i][j] = false;
            s.clear();
        }
    if (a == 0)
    {
        cout << "impossible" << endl;
        cout << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    int k = 0;
    while (t--)
    {
        k++;
        solve(k);
        s.clear();
        a = 0;
    }
    return 0;
}